<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateFilesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('files', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('userable_id')->comment('对应所属用户的ID');
			$table->string('userable_type')->comment('对应所属用户的类名');
			$table->boolean('type')->comment('文件类型 1 文件夹 2 一般文件');
			$table->integer('parent_id')->unsigned()->default(0)->comment('父文件夹ID，为 0 刚表是在根目录下');
			$table->string('key')->comment('文件存储的位置 bos key 或 网址');
			$table->string('name')->comment('用方设置的文件名称');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('files');
	}

}
